<?php
defined('_JEXEC') or die( 'Restricted access' );
jimport( 'joomla.application.component.controller' );
    class adminController extends JController 
    {
        function __construct( $default = array())	
        {
            parent::__construct( $default );
	}
        
        function display($tpl = null) 
        {   
		$view = JRequest::getCmd('view');
		if(empty($view)) {
                    JRequest::setVar('view', 'dashboard');
		};
		parent::display($tpl);
	}
        
        //them van phong moi
        function add_vp()
        {
            $post = JRequest::get('post',4);
            
            $address = $post['sonha']." ".$post['duong'].", ".$post['phuong'].", ".$post['quan'].", ".$post['thanhpho'];
             $row =  & JTable::getInstance('hc_branch', 'Table');
             	$row->name = $post['name'];		 
                $row->descriptiion = $post['des'];				 
                $row->address = $address;
                $row->phone1 = $post['dt1'];	 	 
                $row->phone2 = $post['dt2'];
                $row->phone3 = $post['dt3'];
                $row->phone4 = $post['dt4'];
                $row->Fax1 = $post['fa1'];	 	 
                $row->Fax2 = $post['fa2'];	 	 
                if (!$row->store()) { //thuc thi them record  neu co loi se hien thi
                                              JError::raiseError(500, $row->getError() );
                                                 }  
                $this->setRedirect('index.php?option=com_admin', 'Thêm Văn Phòng Mới Thành Công.');           
        }
        
    }
?>